<!--
========================================================================
 *  Copyright by KNIME AG, Zurich, Switzerland
 *  Website: http://www.knime.com; Email: contact@knime.com
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License, Version 3, as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, see <http://www.gnu.org/licenses>.
 *
 *  Additional permission under GNU GPL version 3 section 7:
 *
 *  KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs.
 *  Hence, KNIME and ECLIPSE are both independent programs and are not
 *  derived from each other. Should, however, the interpretation of the
 *  GNU GPL Version 3 ("License") under any applicable laws result in
 *  KNIME and ECLIPSE being a combined program, KNIME AG herewith grants
 *  you the additional permission to use and propagate KNIME together with
 *  ECLIPSE with only the license terms in place for ECLIPSE applying to
 *  ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the
 *  license terms of ECLIPSE themselves allow for the respective use and
 *  propagation of ECLIPSE together with KNIME.
 *
 *  Additional permission relating to nodes for KNIME that extend the Node
 *  Extension (and in particular that are based on subclasses of NodeModel,
 *  NodeDialog, and NodeView) and that only interoperate with KNIME through
 *  standard APIs ("Nodes"):
 *  Nodes are deemed to be separate and independent programs and to not be
 *  covered works.  Notwithstanding anything to the contrary in the
 *  License, the License does not apply to Nodes, you are not required to
 *  license Nodes under the License, and you are granted a license to
 *  prepare and propagate Nodes, in each case even if such Nodes are
 *  propagated with or for interoperation with KNIME.  The owner of a Node
 *  may freely choose the license terms applicable to such Node, including
 *  when such Node is propagated with or for interoperation with KNIME.
====================================================================
-->
<body>
<p>
The idea behind the <code>BasicPlotter</code> is to provide a small fraction of the 
functionality known from "R" or "GnuPlot", if you have some basic elements, 
such as lines, ellipses, rectangles, you want to add to your view you can use 
the <code>BasicPlotter</code>.
<pre> 
addLine(double[] yValues, Color color, Stroke stroke)
addLine(double[] xValues, double[] yValues, Color color, Stroke stroke)
addRectangle(double x, double y, int width, int height, Color color, Stroke stroke, boolean filled)
addEllipse(double xCenter, double yCenter, double width, double height, Color color, Stroke stroke, boolean filled)
</pre>

The usage of the <code>BasicPlotter</code> methods only makes sense, if the 
the domain values of the elements are known but not the mapped values. 
One example is a scatter plot where you want to add a regression line. 
Here only the domain values of the line are known and can simply be added as a line 
to the plotter with the domain values. 
The <code>BasicPlotter</code> will map the domain values to the drawing pane's size. 
If you set <code>preserve = true</code> in the <code>AbstractPlotter</code> the 
existing ranges of the coordinates won't be adapted. If you set preserve to false, 
the ranges will be adapted if, for example, the added rectangle is larger than 
the existing range of the coordinates.
Another possibility is to add a <code>DataArray</code> which will be visualized 
with a line connecting all values in the columns, where the row number is the 
x axis and the value of the column is painted at the y axis.
<pre>
addLine(DataArray data, int columnIndex, Color color, Stroke stroke)
</pre>

If you want to add a specific element to the <code>BasicPlotter</code> you can 
extend the <code>BasicDrawingElement</code> or the <code>Basic2DDrawingElement</code> 
(described below) with
<pre>
addBasicDrawingElement(BasicDrawingElement element)
</pre>

<p>
<h3>BasicDrawingElement and Basic2DDrawingElement</h3>

A <code>BasicDrawingElement</code> consists of a number of domain values and the 
referring mapped points, a color and a stroke. Whenever the size is changed, 
the <code>BasicPlotter</code> takes the domain values and maps them to the 
current drawing pane size. How the <code>BasicDrawingElement</code> is actually 
painted (depending on the given points) is defined in the paint method which is 
abstract. The <code>Basic2DDrawingElement</code> extends the 
<code>BasicDrawingElement</code> by holding a flag, whether the form should be 
filled or not.
Thus, if you want to add, for example, a triangle you have to extend the 
<code>Basic2DDrawingElement</code> then assert that the given points are the 
left corner, the top and the right corner and define the paint method to connect 
the points or fill the shape.

<h3>BasicDrawingPane</h3>

You can add <code>BasicDrawingElements</code> to the <code>BasicDrawingPane</code>, 
get them and clear the <code>BasicDrawingElements</code> with the following methods:
<pre>
addDrawingElement(BasicDrawingElement element)
getDrawingElements()
clearPlot()
</pre>
</body>
